import { _decorator, Component, instantiate, Vec3, Node, ModelComponent} from 'cc';
import { ResourceManager } from './ResourceManager';

const { ccclass, property } = _decorator;

@ccclass('TableController') // 用 @ccclass 声明类为 Cocos 组件
export class TableController extends Component {
    // 通过 @property 让编辑器可以配置属性
    @property([Node])winds: Node[] = [];


    onLoad() {

    }

    upwardDeck() {

    }

    enableWind(index = 0) {
        const winds = this.winds;
        for(let i = 0; i < winds.length; i++)
        {
            const modelNode = winds[i];
            const modelComponent = modelNode.getComponent(ModelComponent);
            if(modelComponent)
            {
                if(i == index)
                {
                    modelComponent.material = ResourceManager.getTouchCardMat();
                }
                else
                {
                    modelComponent.material = ResourceManager.getTouchCardMat();
                }
            }
            
        }
    }

}